//
//  MoreView.m
//  第六组电影项目
//
//  Created by 6-1 on 14-7-3.
//  Copyright (c) 2014年 www.skedu.com.cn北京尚德智远科技有限公司. All rights reserved.
//

#import "MoreView.h"
#import <QuartzCore/QuartzCore.h>

@implementation MoreView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor=[UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
        _popView=[[UIImageView alloc]initWithFrame:CGRectMake(168, kDeviceHeight-49-182, 145, 182)];
        _popView.userInteractionEnabled=YES;
        _popView.image=[UIImage imageNamed:@"moreView_setting_new"];
        [self addSubview:_popView];
        
        _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, _popView.width, _popView.height-9) style:UITableViewStylePlain];
        _tableView.layer.cornerRadius=5;
        _tableView.backgroundColor=[UIColor clearColor];
        _tableView.scrollEnabled=NO;
        _tableView.dataSource=self;
        _tableView.delegate=self;
        [_popView addSubview:_tableView];
    }
    return self;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    cell.backgroundColor=[UIColor clearColor];
    if (indexPath.row==0) {
        cell.imageView.image=[UIImage imageNamed:@"more_search"];
        cell.textLabel.text=@"搜索";
    }
    else if (indexPath.row==1){
        cell.imageView.image=[UIImage imageNamed:@"more_fav"];
        cell.textLabel.text=@"收藏";
    }
    else if (indexPath.row==2){
        cell.imageView.image=[UIImage imageNamed:@"more_set"];
        cell.textLabel.text=@"设置";
    }
    else {
        cell.imageView.image=[UIImage imageNamed:@"more_info"];
        cell.textLabel.text=@"关于";
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([self.delegate respondsToSelector:@selector(didSelectTableViewCellIndex:)]) {
        [self.delegate didSelectTableViewCellIndex:indexPath.row];
    }
}

//-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
//    if ([self.delegate respondsToSelector:@selector(didMoreViewBackgroundWithTag:)]) {
//        [self.delegate didMoreViewBackgroundWithTag:self.tag];
//    }
//}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
